package com.probiz.estore.system.service.impl;

import java.util.List;

import com.probiz.estore.common.model.system.Carrier;
import com.probiz.estore.common.model.system.SelfCollectionCentre;
import com.probiz.estore.core.service.impl.GenericManagerImpl;
import com.probiz.estore.system.service.SelfCollectionCentreManager;
import com.probiz.estore.system.dao.SelfCollectionCentreDao;


/**
 * Manager implementation for SelfCollectionCentre, responsible for business processing, and communicate between web and persistence layer.
 */
public class SelfCollectionCentreManagerImpl extends GenericManagerImpl<SelfCollectionCentre> implements SelfCollectionCentreManager {

	private SelfCollectionCentreDao selfCollectionCentreDao = null;

	/**
	 * @param selfCollectionCentreDao
	 *            the selfCollectionCentreDao to set
	 */
	public void setSelfCollectionCentreDao(SelfCollectionCentreDao selfCollectionCentreDao) {
		this.selfCollectionCentreDao = selfCollectionCentreDao;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.probiz.estore.core.service.impl.GenericManagerImpl#init()
	 */
	@Override
	protected void initManager() {
		dao = selfCollectionCentreDao;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.probiz.estore.core.service.impl.GenericManagerImpl#preDelete(java.lang.Object)
	 */
	@Override
	protected void preDelete(SelfCollectionCentre entity) {

	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.probiz.estore.core.service.impl.GenericManagerImpl#preSave(java.lang.Object)
	 */
	@Override
	protected void preSave(SelfCollectionCentre entity) {

	}
	/*
	 * (non-Javadoc)
	 * @see com.probiz.estore.system.service.SelfCollectionCentreManager#findActiveSelfCollectionCentres()
	 */
	public List<SelfCollectionCentre> findActiveSelfCollectionCentres() {
		return selfCollectionCentreDao.findActiveSelfCollectionCentres();
	}
	/*
	 * (non-Javadoc)
	 * @see com.probiz.estore.system.service.SelfCollectionCentreManager#isExistedSelfCollectionCentre(com.probiz.estore.common.model.system.SelfCollectionCentre)
	 */
	public boolean isExistedSelfCollectionCentre(SelfCollectionCentre selfCollectionCentre) {
		String propertyName = "selfCollectionCentreName";
		SelfCollectionCentre tmpSelfCollectionCentre = selfCollectionCentreDao.getUniqueByProperty(propertyName,
				selfCollectionCentre.getSelfCollectionCentreName());
		if (tmpSelfCollectionCentre == null) {
			return false;
		} else {
			return true;
		}
	}
	/*
	 * (non-Javadoc)
	 * @see com.probiz.estore.system.service.SelfCollectionCentreManager#isExistedSelfCollectionCentreForUpdate(com.probiz.estore.common.model.system.SelfCollectionCentre)
	 */
	public boolean isExistedSelfCollectionCentreForUpdate(SelfCollectionCentre selfCollectionCentre) {
		return selfCollectionCentreDao.isExistedSelfCollectionCentreForUpdate(selfCollectionCentre);
	}

	/*
	 * (non-Javadoc)
	 * @see com.probiz.estore.system.service.SelfCollectionCentreManager#getSelfCollectionCentreListByRegionId(java.lang.Integer)
	 */
	public List<SelfCollectionCentre> getSelfCollectionCentreListByRegionId(Integer regionId){
		return selfCollectionCentreDao.getSelfCollectionCentreListByRegionId(regionId);
	}

}
